package com.dyoud.api.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.dyoud.core.jedis.JedisFactoryBean;

@Configuration
/**
 * 
 * @author Jonathan
 *
 */
public class JedisConfig {

    @Value("${redis.host}")
    private String host;
    @Value("${redis.port}")
    private int port;
    @Value("${redis.timeout}")
    private int timeout;

    @Bean
    public JedisFactoryBean jedisPool() {
        JedisFactoryBean jedisFactoryBean = new JedisFactoryBean();
        jedisFactoryBean.setHost(host);
        jedisFactoryBean.setPort(port);
        jedisFactoryBean.setTimeout(timeout);
        return jedisFactoryBean;
    }

}
